<template style="width: 100%; height: 100%; overflow-y: auto;">
    <div style="position: absolute; right: 10px; top: 10px; width: 200px; height: 100px; font-size: 24px;" class="btn" onclick=ClickCopyCutBoard>复制到剪切板</div>
    <div style="position: absolute; right: 10px; top: 110px; width: 200px; height: 100px; font-size: 24px;" class="btn" onclick=ClickAppendCssCodeBtn>追加CSS代码</div>
    <div style="position: absolute; right: 10px; top: 210px; width: 200px; height: 100px; font-size: 24px;" class="btn" onclick=ClickAppendScriptCodeBtn>追加脚本代码</div>

    <div v-show="IsShowCssCodeDialog" class="css-code-dialog">
        <WindowTitleBar title="CSS 代码追加框" v-bind:close="CloseCssDialog"></WindowTitleBar>
        <div style="position: absolute; top: 50px; left: 10px; right:10px; bottom: 60px;">
            <textarea v-model="CssCode" style="width: 100%; height: 100%;" placeholder="Css 代码"></textarea>
        </div>
        <div onclick=ClickAppendCssCodeConfirmBtn style="position: absolute; left: 10px; right:10px; bottom: 5px; height: 50px;" class="btn">确定</div>
    </div>

    <div v-show="IsShowScriptCodeDialog" class="css-code-dialog">
        <WindowTitleBar title="脚本代码追加框" v-bind:close="CloseScriptDialog"></WindowTitleBar>
        <div style="position: absolute; top: 50px; left: 10px; right:10px; bottom: 60px; display: flex; flex-direction: column;">
            <input v-model="ScriptFileName" style="height: 40px; width: 100%;" placeholder="脚本文件路径"></input>
            <textarea v-model="ScriptCode" style="width: 100%; flex: 1; height: auto;" placeholder="脚本代码"></textarea>
        </div>
        <div onclick=ClickAppendScriptCodeConfirmBtn style="position: absolute; left: 10px; right:10px; bottom: 5px; height: 50px;" class="btn">确定</div>
    </div>
    {{AllCode}}
</template>

<script type="text/lua">
RegisterComponent("WindowTitleBar", "%vue%/Components/WindowTitleBar.html");

IsShowCssCodeDialog = false;
CssCode = ""

IsShowScriptCodeDialog = false;
ScriptFileName = "";
ScriptCode = "";

function ClickCopyCutBoard()
    ParaMisc.CopyTextToClipboard(GetGlobalScope():Get("AllCode"));
    Tip("代码已复制到剪切板");
end 

function ClickAppendCssCodeBtn()
    IsShowCssCodeDialog = true;
end 

function CloseCssDialog()
    IsShowCssCodeDialog = false;
end

function ClickAppendCssCodeConfirmBtn()
    IsShowCssCodeDialog = false;
    GetGlobalScope():Set("CssCode", CssCode);
    _G.GenerateCode();
end

function ClickAppendScriptCodeBtn()
    IsShowScriptCodeDialog = true;
end

function CloseScriptDialog()
    IsShowScriptCodeDialog = false;
end 

function ClickAppendScriptCodeConfirmBtn()
    IsShowScriptCodeDialog = false;
    GetGlobalScope():Set("ScriptCode", ScriptCode);
    GetGlobalScope():Set("ScriptFileName", ScriptFileName);
    _G.GenerateCode();
end 

</script>

<style scoped=true>
.css-code-dialog {
    position: absolute;
    left: 20%;
    top: 20%;
    width: 60%;
    height: 60%;
    background: url(Texture/Aries/Creator/keepwork/Window/dakuang_32bits.png#0 0 440 93:378 43 33 44);
}
</style>